home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
COMPILER
/
SATHER
/
!Sather
/
Library
/
Graphs
/
sa
/
abs_ugraph
< prev
next >
Wrap
Text File
|
1996-07-13
|
3KB
|
64 lines
---------------------------> Sather 1.1 source file <--------------------------
-- Author: Benedict A. Gomes <gomes@icsi.berkeley.edu>
-- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
-- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
-- LICENSE contained in the file: Sather/Doc/License of the
-- Sather distribution. The license is also available from ICSI,
-- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
-------------------------------------------------------------------
abstract class $RO_UGRAPH{NTP} < $GRAPH{NTP,UEDGE{NTP}} is
-- Undirected graphs. NTP indicates the type of the node index
-- which is used internally by a graph implementation to access
-- its
--
-- Since there is no valid subtyping relationship between ugraphs
-- and digraphs (neither is a proper subtype of the other) and due
-- to the subtle relationships between them, there is no subtyping
-- relationship between directed and undirected graphs. We (will)
-- provide explicit conversion methods and adaptor "views" to see a
-- digraph as an undirected graph and vice versa
copy: $RO_UGRAPH{NTP};
-- Return a copy of the graph
equals(g: $RO_UGRAPH{NTP}): BOOL;
-- Return true if self = "g" i.e. if all the nodes and edges are equal
-- (by is_eq)
end;
-------------------------------------------------------------------
abstract class $UGRAPH{NTP} < $RO_UGRAPH{NTP} is
-- A modifiable undirected graph. It has edges of type UEDGE{NTP},
-- which are simply unordered pairs of nodes
add_node: NTP;
-- Add a node to the graph and return the node index, which is an
-- internal reference to the node (used within the graph implementation)
add_node(n: NTP): NTP;
-- Add a node to the graph and return the new node index, which is an
-- internal reference to the node (used within the graph implementation)
-- The node that is returned may or may not be the same as the node
-- "n" that is passed in as an argument.
connect(e: UEDGE{NTP});
-- Connect the nodes specified by edge "e". i.e. create an edge
-- between e.first and e.second
-- Usage: g: DIGRAPH{INT} := #;
-- n3 ::= g.add_node;
-- n4 ::= g.add_node;
-- g.connect(#DIEDGE{INT}(n3,n4));
-- Note that UGRAPH_INCL has wrappers to allow you to write g.connect(n3,n4);
delete_node(n: NTP);
-- Delete the node "n" from the graph, and any associated edges
disconnect(e: UEDGE{NTP});
-- Remove the edge "e" from the graph, from between nodes
-- e.first and e.second
end;
-------------------------------------------------------------------